package study;

import pro1.CountTest;

import java.util.List;
import java.util.Stack;

/**
 * @version 1.0
 * @since:
 * @ClassName:StackTest
 * @author: Li Jiahui
 * @date: 2021-04-25 16:11
 */
public class StackTest {
    public static void main(String[] args) {
        //1.准备一个Stack集合，并打印
        Stack lt1 = new Stack();
        Stack lt2 = new Stack();
        System.out.println("lt1 = " + lt1);
        //2.将数据11，22，33，44，55依次入栈并打印
        for(int i = 1 ; i <= 5; i++){
            Object push = lt1.push(i * 11);
            System.out.println("入栈的元素是：" + push);
        }
        //3.查看栈顶元素值并打印
        Object obj2 = lt1.peek();
        System.out.println("查看此栈中顶部的对象：" + obj2);
        //4.对栈中所有元素依次出栈
        int len = lt1.size();
        for(int i= 1 ; i<=len; i++){
            Object ot = lt1.pop();
            System.out.println(ot);
            lt2.push(ot);
        }
        //5.打印栈中的所有元素
        System.out.println(lt1);

    }
}
